<template>
    <div class="film-reviews">
        <div class="avatar">
            <img :src="item.author.avatarurl"/>
        </div>
        <div class="detial">
            <div class="nm-score">
                <div class="nm">
                    <span>{{item.author.nickName}}</span>
                    <i :class="`lv${item.author.userLevel}`"></i>
                </div>
                <div class="score">
                    <span>{{item.sc*2}}分</span>
                </div>
            </div>
            <div class="article">
                <h3 class="title">{{item.title}}</h3>
                <p class="text">{{item.text}}</p>
            </div>
            <div class="time">
                <span>{{item.created|filtime}}</span>
                <div><i class="iconfont icon-pinglun"></i>&nbsp;{{item.commentCount}}</div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props:{
        item:Object
    },
    filters:{
        filtime(time){
            let date=new Date(time);
            let m=date.getMonth()+1;
            let d=date.getDate();
            m=m<10?'0'+m:m;
            d=d<10?'0'+d:d;
            return m+"-"+d;
        },
    },
}
</script>

<style lang="less" scoped>
.film-reviews{
    padding: 15px 0 0 15px;
    display: flex;

    .avatar{
        width: 34px;
        height: 34px;
        border-radius: 50%;
        overflow: hidden;

        img{
            display: block;
            width: 100%;
        }
    }

    .detial{
        flex: 1;
        margin-left: 10px;
        padding: 0 15px 15px 0;
        position: relative;
        font-size: 12px;
        overflow: hidden;

        &::after{
            content: "";
            width: 100%;
            position: absolute;
            bottom: 0;
            left: 0;
            border-bottom: 1px solid #eee;
        }

        .nm{
            i{
                margin-left: 8px;
                display: inline-block;
                width: 36px;
                height: 16px;
                vertical-align: sub;

                &.lv2{
                    background: url(../assets/lv2.png) no-repeat;
                    background-size: contain;
                }

                &.lv3{
                    background: url(../assets/lv3.png) no-repeat;
                    background-size: contain;
                }
            }
        }

        .score{
            padding-top: 3px;
            span{
                color: #faaf00;
            }
        }

        .article{
            padding: 10px 0;
            font-size: 15px;
            color: #333;

            .title,.text{
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
            }

            .text{
                font-size: 13px;
                color: #666;
                line-height: 20px;
            }
        }

        .time{
            color: #666;
            display: flex;
            justify-content: space-between;
            padding-right: 15px;

            i{
                vertical-align: middle;
            }
        }
    }
}
</style>